package com.mic.yzzn.plc.model;

import java.util.Date;
import java.util.Map;



public class StationStatus{
	
	public static final String CYCLE_QUEUE_KEY = "CYCLE_QUEUE_KEY",
								RTW_QUEUE_KEY = "RTW_QUEUE_KEY",
								RTR_QUEUE_KEY = "RTW_QUEUE_KEY";
 
	private Station station;
	
	/**
	 * 运行状态 (running, wait)
	 * PLCCollectorStateActive = 0,
	 * PLCCollectorStateSleep = 1,
	 * PLCCollectorStateStop = 2;
	 */
	private int status;
	
	/** 采集器开始采集的时间 */
    private Date startTime;
    
    /**  e.g. {CYCLE_QUEUE_KEY : StationQueueStatus} */
    private Map<String, StationQueueStatus> queueStatus;
	
	public StationStatus(){}

	
	public StationStatus(Station station, int status, Date startTime, Map<String, StationQueueStatus> queueStatus) {
		this.station = station;
		this.status = status;
		this.startTime = startTime;
		this.queueStatus = queueStatus;
	}

	@Override
	public String toString()
	{
		StringBuffer buffer = new StringBuffer();
		buffer.append(station + "采集器 ");
		buffer.append("从" + startTime + "开始采集 ");
		buffer.append("目前处于" + status + " 状态\n");
		buffer.append("周期队列: " + queueStatus.get(CYCLE_QUEUE_KEY).toString() + "\n");
		buffer.append("实时读队列: " + queueStatus.get(RTR_QUEUE_KEY).toString() + "\n");
		buffer.append("实时写队列: " + queueStatus.get(RTW_QUEUE_KEY));

		return buffer.toString();
	}




	public Station getStation() {
		return station;
	}


	public void setStation(Station station) {
		this.station = station;
	}


	public int getStatus() {
		return status;
	}


	public void setStatus(int status) {
		this.status = status;
	}


	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Map<String, StationQueueStatus> getQueueStatus() {
		return queueStatus;
	}

	public void setQueueStatus(Map<String, StationQueueStatus> queueStatus) {
		this.queueStatus = queueStatus;
	}
	
	
	
}
